Skip to main content

Velocity Override for SoftMotion Axes

The BasicMotion_Override.project sample project described here is located in the installation directory of CODESYS under ..\CODESYS SoftMotion\Examples.

This example shows how to define a velocity override for a SoftMotion axis.

For more information about override, see: Dynamic Adaptation with MC_SetOverride

Structure of the application

The application consists of a PLC_PRG program and a Trace.

PLC_PRG

The program consists of a simple state machine. In the first state STATE_POWER, the virtual axis Drive is initialized. In the second state STATE_COMMAND_MOVEMENT, a velocity override of 0.5 is set so that the movements of the axis are executed only at half velocity. A movement is then executed using MC_MoveAbsolute to position 10. A maximum velocity of 20 units/s is specified in the function block.

Due to the velocity override which is set in the virtual axis, the movement is executed at a maximum velocity of 10 units/s.

As soon as half of the movement is completed at position 5, the velocity override is reduced to 0.25 in the STATE_CHANGE_OVERRIDE state. The axis decelerates to 5 units/s and performs the rest of the movement at this velocity.

The active override factors (velocity, acceleration, and jerk) of the virtual axis are also read in the program. The SMC_GetOverride function block is used for this.

Trace

The trace can be used to track the movement of the virtual axis. The currently specified position, the velocity, and the acceleration of the axis and the active velocity override are recorded.

Commissioning

  1. Build the application and download it to a controller.

  2. Start the trace and the application.

In the trace, you can track the movement of the virtual axis.